@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
}

@layer utilities {
  .typing-indicator {
    @apply inline-flex space-x-1;
  }
  .typing-dot {
    @apply w-2 h-2 bg-primary rounded-full animate-pulse;
    animation-delay: calc(var(--delay) * 0.1s);
  }
}

/* Markdown content styles */
.markdown-content {
  color: hsl(var(--foreground));
  line-height: 1.6;
  font-size: 0.875rem; /* 14px base size */
}

.markdown-content p {
  margin-bottom: 0.75rem;
}

.markdown-content p:last-child {
  margin-bottom: 0;
}

/* Headers - ensure they stand out */
.markdown-content h1 {
  color: hsl(var(--foreground));
  font-size: 1.125rem; /* 18px */
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.markdown-content h2 {
  color: hsl(var(--foreground));
  font-size: 1rem; /* 16px */
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
}

.markdown-content h3 {
  color: hsl(var(--foreground));
  font-size: 0.875rem; /* 14px */
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  color: hsl(var(--foreground));
  font-size: 0.875rem; /* 14px */
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Lists */
.markdown-content ul,
.markdown-content ol {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.markdown-content li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.markdown-content li:last-child {
  margin-bottom: 0;
}

/* Code */
.markdown-content code {
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.75rem; /* 12px */
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

.markdown-content pre {
  background-color: hsl(var(--muted));
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.75rem; /* 12px */
}

/* Blockquote */
.markdown-content blockquote {
  border-left: 4px solid hsl(var(--primary));
  padding-left: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  font-style: italic;
  color: hsl(var(--muted-foreground));
}

/* Table */
.markdown-content table {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  width: 100%;
  border-collapse: collapse;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid hsl(var(--border));
  padding: 0.5rem;
  text-align: left;
  font-size: 0.75rem; /* 12px */
}

.markdown-content th {
  background-color: hsl(var(--muted));
  font-weight: 600;
}

/* Links */
.markdown-content a {
  color: hsl(var(--primary));
  text-decoration: underline;
}

/* Emphasis */
.markdown-content strong {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.markdown-content em {
  font-style: italic;
  color: hsl(var(--foreground));
}

/* Horizontal rule */
.markdown-content hr {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* Dark mode adjustments */
.dark .markdown-content h1,
.dark .markdown-content h2,
.dark .markdown-content h3,
.dark .markdown-content h4,
.dark .markdown-content h5,
.dark .markdown-content h6,
.dark .markdown-content strong,
.dark .markdown-content em {
  color: hsl(var(--foreground));
}

.dark .markdown-content code {
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.dark .markdown-content pre {
  background-color: hsl(var(--muted));
}

.dark .markdown-content blockquote {
  color: hsl(var(--muted-foreground));
}

.dark .markdown-content th {
  background-color: hsl(var(--muted));
}